<?php
/**
 * Autor:   Miguel A. Zilli
 * Email:   miguelzilli@gmail.com
 */

class Atributosxinstalacion extends AppModel {
    var $name='Atributosxinstalacion';
    var $useTable='atributosxinstalaciones';
    var $primaryKey='id';
    var $displayField='valor_atr';
    var $recursive=0;
    var $order=array(
       'Atributosxinstalacion.valor_atr'=>'ASC'
    );

//    var $validate= array(
//        'valor_atr'=>array(
//            array('rule'=>'notEmpty','message'=>'Debe completar este dato.','required'=>true)
//        )
//    );

    var $belongsTo= array(
        'Instalacion' => array (
            'className' => 'Instalacion',
            'foreignKey' => 'instalacion_id'
        ),
        'Atributo' => array (
            'className' => 'Atributo',
            'foreignKey' => 'atributo_id'
        )
    );

    public function beforeSave(){
        if(!empty($this->data['Atributosxinstalacion'])){
            foreach($this->data['Atributosxinstalacion'] as $campo=>$valor){
                $this->data['Atributosxinstalacion'][$campo]=strtoupper($valor);
            }
        }
        return true;
    }
}
?>